<?php

 	require_once 'fetchInfo.php';
      
 	require_once '../services/config/connection.php';
	require_once '../services/model/dao/vo/VehicleVO.php';
	require_once '../services/model/dao/vo/MessageVO.php';
        require_once '../services/model/dao/VehicleDAOImpl.php';
        require_once("auth/sso.php");
      
/*$sso = new SingleSignOn_Broker();
$users = $sso->getInfo();

if (!$users) {
    header("Location: login.php", true, 307);
    exit;
}*/
$users["identity"]=2;
$user_active = $users["identity"];
require_once('user_assets.php');

        
	
	$vehicle_key = $_GET["id"];
	$vehicleVO = new VehicleVO();
	$_instance = new FetchInfo();
	if($user->role_id==8)
        {
            $vehicle_dao = new VehicleDAOImpl;
             $vehicleVO = $vehicle_dao->getTowerVehicleByID($vehicle_key,$user->company_id);
        }
        else
        {    
	 $vehicleVO = $_instance->getVehicleByVehicleID($vehicle_key);
        }  
	$accepted_price = '';
	
	if($vehicleVO==NULL)
        { ?>
            <div style="margin-top:20%;margin-left: 40%"><h3>You are not allowed to view this page</h3></div>
           <?php exit;  
              
        }
 	//if (((strtolower($vehicleVO->i_want_to)== "donate my vehicle")&& $vehicleVO->bid_price==0)||((strtolower($vehicleVO->i_want_to)== "donate my vehicle")&& $vehicleVO->bid_price!=0)) 	{
 		//$accepted_price = "Donate";
 	///}
 	//else if ((strtolower($vehicleVO->i_want_to)!= "donate my vehicle")&& $vehicleVO->bid_price==0)  	{
 		//$accepted_price = "Contact Buyer";
 	//}
 	//else 	{
 		//$accepted_price = $vehicleVO->bid_price;
 	//}
	if (strtolower($vehicleVO->i_want_to)== "donate my vehicle") {
 		$accepted_price = "Donate";
 	}else {
 		if($vehicleVO->accepted_price!=0){
 			$accepted_price = $vehicleVO->accepted_price;
 		}else {
 			$accepted_price = 'Contact Buyer';
 		}
 	}
$phone ='';
	$phone =  preg_replace('/\d{3}/', '$0-', str_replace('-', null, trim($vehicleVO->phone)), 2);
	
	$cell_phone = '';
	$cell_phone =  preg_replace('/\d{3}/', '$0-', str_replace('-', null, trim($vehicleVO->cell_phone)), 2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0048)file:///C:/wamp/www/Autogator/autogator_bid.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Vehicle's Bid Informations</title>
<link href="css/main-print.css" rel="stylesheet" type="text/css">
</head>
<body>


<div class="boxBlack">
<div class="boxBodyBlack">
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td width="50%"><b><?php echo $vehicleVO->year?>&nbsp;<?php echo $vehicleVO->make_name?>&nbsp;<?php echo $vehicleVO->model_name?></b></td>
<td width="50%"align="right"><b>Bid# <?php echo $vehicleVO->vehicle_id?></b></td>
</tr>
<tr>
<td width="50%"><b><?php echo $vehicleVO->street_address?></b></td>
<td width="50%" align="right"><b><?php echo $vehicleVO->first_name?></b></td>
</tr>
<tr>
<td width="50%"><b><?php echo $vehicleVO->city?>&nbsp;<?php echo $vehicleVO->state?>&nbsp;<?php echo $vehicleVO->zip?></b></td>
<td width="50%" align="right"><b><?php echo $phone?></b></td>
</tr>
</table>
<div class="boxCrnr" >
<div class="boxBodyCrnr">
<h2>Towing Information</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody>
  <tr>
    <td width="50%" align="left" valign="top"><?php echo $vehicleVO->delivery?></td>
     <td width="50%" align="right" valign="top">Price: <?php echo $accepted_price; ?></td>
    </tr>
    <tr>
    <td width="50%" align="left" valign="top">Remove By: <?php echo $vehicleVO->removal_date?></td>
     <td width="50%" align="right" valign="top">&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2>Transport Note</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody>
  <tr>
    <td width="68%" align="left" valign="top"><?php echo $vehicleVO->delivery_note?></td>
    </tr>
  </tbody>
</table>
</div>
 </div>


<div class="boxLblue floatLeft" style="width:49%" >
 <div class="boxLblueTr"><h2>Vehicle Information</h2></div> 
<div class="boxBodyLblue">
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#CCCCCC">
<tbody><tr>
<td width="38%" align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Year: </td>
<td width="62%" align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->year?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Make: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->make?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Model: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->model?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Color: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->color?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Mileage: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->mileage?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Vin#: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->vin?></td>
</tr>
<tr>
<td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Drivetrain Type: </td>
<td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->drivetrain_type?></td>
</tr>
</tbody></table>
<div class="more"><a class="button" href="file:///C:/wamp/www/Autogator/autogator_bid.html#"><span>More</span></a></div>
<div class="clearBoth"></div>

</div>
 </div>

<div class="boxLblue floatRight"  style="width:49%" >
<div class="boxLblueTr"><h2>Location</h2></div> 
    <div class="boxBodyLblue">
    <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#CCCCCC">
    <tbody><tr>
    <td width="38%" align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Located at: </td>
    <td width="62%" align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->located_at?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Bussiness Name: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->bussiness_name?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Contact: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->contact_name?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Address: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->v_street_address?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">City: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->v_city?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">State: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->v_state?></td>
    </tr>
    <tr>
    <td align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF">Zip: </td>
    <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $vehicleVO->v_zip?></td>
    </tr>
    
    </tbody></table>
    <div class="more"><a class="button" href="file:///C:/wamp/www/Autogator/autogator_bid.html#"><span>More</span></a></div>
    <div class="clearBoth"></div>
    </div>
 </div>


<div class="clearBoth"></div>
<div class="boxCrnr" >
<div class="boxBodyCrnr">
<h2>What's wrong with your vehicle?</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="68%" align="left" valign="top"><?php echo $vehicleVO->wrong?></td>
</tr>
</tbody></table>
<h2>What's great about your vehicle?</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="68%" align="left" valign="top"><?php echo $vehicleVO->great?></td>
</tr>
</tbody></table>
<h2>Paper work</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="50%" align="left" valign="top">Title Status: <?php echo $vehicleVO->paper_work?></td>
<td width="50%" align="right" valign="top">Name on Title: <?php echo $vehicleVO->title_name?></td>
</tr>
</tbody></table>
<h2>Title Note:</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="68%" align="left" valign="top"><?php echo $vehicleVO->title_note?></td>
</tr>
</tbody></table>
<div class="more"><a class="button" href="file:///C:/wamp/www/Autogator/autogator_bid.html#"><span>More</span></a></div>

<div class="clearBoth"></div>

</div>
</div>

<div class="clearBoth"></div>

<div class="boxCrnr" >

<div class="boxBodyCrnr">
<h2>Owner Information</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="50%" height="22" align="left" valign="top">Owner Name: <?php echo $vehicleVO->first_name?></td>
<td width="50%" align="right" valign="top">Phone 1: <?php echo $phone?></td>
</tr>
<tr>
<td width="50%" align="left" valign="top"></td>
<td width="50%" align="right" valign="top">Phone 2: <?php echo $cell_phone?></td>
</tr>
</tbody></table>
<h2>Seller Note:</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tbody><tr>
<td width="68%" align="left" valign="top"><?php echo $vehicleVO->contact_note?></td>
</tr>
</tbody></table>
</div>
<div class="clearBoth"></div>

</div>


<div class="clearBoth"></div>
    <div class="boxCrnr" >
    <div class="boxBodyCrnr">
    <h2>Vehicle's snaps </h2>
    <div class="vSnaps">
    <?php 
     $img_result = $_instance->createImageThump($vehicleVO->image_collection);
     echo $img_result;
    ?>
    <div class="clearBoth"></div>
    </div>
    <div class="spacer"></div>
    <table width="100%" border="0" cellspacing="0" cellpadding="2"> 
    <tbody><tr> 
    <td width="50%" align="left" valign="top">Delivered by: ____________________________</td> 
    <td width="50%" align="left" valign="top">Date: ____________________________</td> 
    </tr> 
    </tbody></table>
    
    <div class="more"><a class="button" href="file:///C:/wamp/www/Autogator/autogator_bid.html#"><span>More</span></a></div>
    <div class="clearBoth"></div>
    
    </div>
    <div class="clearBoth"></div>
    </div>
<div class="clearBoth"></div>

</div>
  <div class="clearBoth"></div>
</div> 
</body></html>